<?php
include_once("functions/db_manipulate.php");

if (init()) {
  redirect("?action=index");
  exit();
}

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <meta http-equiv="Content-Type"
        content="text/html; charset=<?=getMessageByKey("default.charset") ?>"/>
  <title><?= getMessageByKey("login.title") ?></title>
  <link rel="stylesheet" type="text/css" href="css/navigation.css">
  <link rel="stylesheet" type="text/css" href="css/menu.css">
  <link rel="stylesheet" type="text/css" href="css/common.css">
  <link rel="stylesheet" type="text/css" href="css/registration.css">
  <script src="resources/jquery.js"></script>
  <meta name="keywords"
        content="<?= getMessageByKey('indexflies.keywords')?>">
  <meta name="description" content="<?= getMessageByKey('login.description')?>">
</head>
<body>

<?php
include_once("menu.php");
?>

<div class="loginheader">
  <?= getMessageByKey("login.header") ?>
</div>

<form action="?action=loghand" method="post" id="loginform">
  <div class="logindiv">
    <div class="tr">
      <div class="td">
        <?= getMessageByKey("login.form.login") ?>
      </div>
      <div class="td">
        <input type="text" value="<?= $_COOKIE['login'] ?>" name="login">
      </div>
    </div>
    <div class="tr">
      <div class="td">
        <?= getMessageByKey("login.form.pass") ?>
      </div>
      <div class="td">
        <input type="password" value="<?= $_COOKIE['pass'] ?>" maxlength="20" name="pass">
      </div>
    </div>
    <div class="tr">
      <div class="td" style="font-size: medium;">
        <?= getMessageByKey("login.form.save") ?>
      </div>
      <div class="td" style="text-align: right;">
        <input type="checkbox" name="save" value="on">
      </div>
    </div>
    <div class="tr">
      <div class="button" onclick="$('#loginform').submit()">
        <?= getMessageByKey("button.login.enter") ?>
      </div>
      <div class="button" onclick="location.href='?action=forgot'">
        <?= getMessageByKey("button.login.forgot") ?>
      </div>
      <div class="button" onclick="location.href='?action=reg'">
        <?=  getMessageByKey("button.login.registration") ?>
      </div>
      <div class="button" onclick="location.href='?action=index'">
        <?= getMessageByKey("button.login.cancel") ?>
      </div>
    </div>

  </div>
</form>

<?php
include_once("navigation.php");
?>

</body>
</html>
